<template>
	<view>
		<view class="wait-box" v-if="info.order.pend_text && info.order.pend_text.length > 0">
			<view class="wait-title">待付信息</view>
			<!--
				问题1.
					律师请款需要弹窗
				item.money 请款金额
				item.reason 请款事由

				问题2.
					结算投资收益需要弹弹窗

			-->
			<view class="wait-item"  v-for="(item, index) in info.order.pend_text">
				<view class="item-item flex flex-vertical">
					<view class="flex flex-horizontal " @click="itemClick(item)" v-if="item.origin != '后期费用'">
						<view class="item-money">
							<view>￥{{ item.money }}</view>
						</view>
						<view class="" >
							<view class="txt-name">{{ item.name }}</view>
							<view class="txt-tip" style="margin-top: 20rpx;">{{ item.time }}</view>
						</view>
						<image v-if="item.shou_type == 2 || item.type == 1 || item.type==6 || item.type==7" class="image-r" style="width: 16rpx;height: 28rpx;margin-top: 6rpx;"  src="@/static/img/right.png" mode="widthFix"></image>

					</view>
					<view class="flex flex-horizontal " v-if="item.origin == '后期费用'">
						<view class="item-money">
							<view style="color: #303133;" :style="item.is_shou == 1? 'color: #f00;padding-left: 25rpx;':''">{{ item.is_shou == 1?'￥'+item.money:'￥待计算:' }}</view>
						</view>
            <view v-if="item.is_shou == 1" @click.stop="	current_item = item;$refs.popupReceiveMoneydetail.open()" style="display: flex;align-items: center">
              <view class="txt-name">
                后期费用
              </view>
              <view class="txt-nav" style="    margin-top: 2px;margin-left:5px;width: 10px;height: 15px;"><image src="@/static/img/right.png" mode="widthFix" style="width: 16rpx;height: 24rpx;"></image></view>
            </view>
            <view v-else>
              <view v-if="info.order.offer == '活马'">

                <view class="txt-name" style="color: #f00;" v-if="info.order.self_ident == '收款方'">
                  按律师帮您回收款物
                </view>
                <view class="txt-name" style="color: #f00;" v-if="info.order.self_ident == '应诉方'">
                  按律师帮您减少支出
                </view>
                <view class="txt-tip" style="margin-top: 20rpx;color: #f00;">金额的{{info.order.order_later_money}}算</view>
              </view>
              <view v-if="info.order.offer == '还魂马'">
                <view class="txt-name" style="color: #f00;" v-if="info.order.self_ident == '收款方'">
                  按律师帮您回收款物
                </view>
                <view class="txt-name" style="color: #f00;" v-if="info.order.self_ident == '应诉方'">
                  按律师帮您减少支出
                </view>
                <view class="txt-tip" style="margin-top: 20rpx;color: #f00;">金额的30%算</view>
              </view>
            </view>
					</view>
					<view class="item-btn flex flex-horizontal flex-center " style="margin-top: 10px;">
						<view
							class="comfir-btn flex flex-1 flex-center"
							type="default"
							style="max-width: 50%;"
							v-if="item.type == 6 || item.type == 1"
							@click="current_item = item;$refs.popupCancelPay.open();"
						>
							取消付款
						</view>
						<view
							class="comfir-btn flex flex-1 flex-center"
							type="default"
							style="max-width: 50%;"
							v-if="item.origin != '后期费用'"
							@click="
								current_item = item;
								$refs.popupWantPay.open();
							"
						>
              <uni-countdown
                  v-if="item.isfinshed&&(item.lvShiTime.hour>0||item.lvShiTime.minute>0||item.lvShiTime.second>0)"
                  :show-day="false"
                  :hour="item.lvShiTime.hour"
                  :minute="item.lvShiTime.minute"
                  :second="item.lvShiTime.second"
                  color="#f00"
                  splitorColor="#f00"
                  backgroundColor="#FFC801"
                  @timeup="timeup($event,index,item)"
              ></uni-countdown>
							我要付款
						</view>
						<view
							class="comfir-btn flex flex-1 flex-center"
							type="default"
							style="max-width: 50%;"
							v-if="item.origin == '后期费用'"
							@click="popupPayToLawClick(item);

							"
						>
              <uni-countdown
                  v-if="item.isfinshed&&(item.lvShiTime.hour>0||item.lvShiTime.minute>0||item.lvShiTime.second>0)"
                  :show-day="false"
                  :hour="item.lvShiTime.hour"
                  :minute="item.lvShiTime.minute"
                  :second="item.lvShiTime.second"
                  color="#f00"
                  splitorColor="#f00"
                  backgroundColor="#FFC801"
                  @timeup="timeup($event,index,item)"
              ></uni-countdown>
							我要付款
						</view>
						<template v-if="item.is_shou == 1">
							<view
								class="comfir-btn flex flex-1 flex-center"
								type="default"
								v-if="item.shou_type == 2"
								@click="
									current_item = item;
									$refs.popupReturnReason2.open();
								"
							>
								退回申请
							</view>
							<view
								class="comfir-btn flex flex-1 flex-center"
								type="default"
								v-else
								@click="
									current_item = item;
									$refs.popupReturnReason.open();
								"
							>
								退回申请
							</view>
						</template>
					</view>
				</view>

				<view class="item-item flex flex-vertical" v-if="item.late_fee && Number(item.late_fee)" @click="lateFeeDetail(item)">
					<view class="flex flex-horizontal ">
						<view class="item-money">
							<view>￥{{ item.late_fee }}</view>
						</view>
						<view class="item-txt">
							<view class="txt-name">
								<view class="name-tip text-ellipsis">滞纳金</view>
								<view class="txt-nav"><image src="@/static/img/right.png" mode="widthFix"></image></view>
							</view>
						</view>
					</view>
					<view class="item-btn flex flex-horizontal flex-center " style="margin-top: 10px;" v-if="item.is_shou == 0">
            <template  v-if="!item.isapplay">
              <button
                  v-if="!item.isapplay"
                  class="ok-btn marginbottom10"
                  type="default"
                  @click.stop="
										feeBeginTime = '';
										feeEndTime = '';
										feeMoney = '';
										feeReason = '';
										current_item = item;
										getCurrentFeeList();
										$refs.popupReduceFee.open();
									"
              >
                减免滞纳金
              </button>
            </template>
						<template v-else>
							<view
								class="comfir-btn flex flex-1 flex-center"
								type="default"
								@click.stop="
										current_item = item;
										$refs.popupCancelReduceFee.open();
									"
							>
								取消申请
							</view>
							<view
								class="comfir-btn flex flex-1 flex-center"
								type="default"
								@click.stop="$refs.telephoneLawyer.$refs.popupTel.open()"
							>
								催促律师确认减免
							</view>
						</template>
					</view>
				</view>
			</view>
			<!--  -->
			<!--  -->
			<!-- 活马  还魂马 -->
			<!--
			 应诉方 32   收款方 33   -->
		<!-- 	<view class="wait-item" v-if="info.order.offer == '活马' || info.order.offer == '还魂马'">
				<view class="item-item flex flex-vertical">
					<view class="flex flex-horizontal ">
						<view class="item-money">
							<view style="color: #303133;">后期费用:</view>
						</view>
						<view v-if="info.order.offer == '活马'">

							<view class="txt-name" style="color: #f00;padding-left: 25rpx;" v-if="info.order.self_ident == '收款方'">
								按律师帮您回收款物
							</view>
							<view class="txt-name" style="color: #f00;padding-left: 25rpx;" v-if="info.order.self_ident == '应诉方'">
								按律师帮您减少支出
							</view>
							<view class="txt-tip" style="margin-top: 20rpx;color: #f00;padding-left: 25rpx;">金额的8%计算</view>
						</view>
						<view v-if="info.order.offer == '还魂马'">
							<view class="txt-name" style="color: #f00;padding-left: 25rpx;" v-if="info.order.self_ident == '收款方'">
								按律师帮您回收款物
							</view>
							<view class="txt-name" style="color: #f00;padding-left: 25rpx;" v-if="info.order.self_ident == '应诉方'">
								按律师帮您减少支出
							</view>
							<view class="txt-tip" style="margin-top: 20rpx;color: #f00;padding-left: 25rpx;">金额的30%计算</view>
						</view>
					</view>
					<view class="item-btn flex flex-horizontal flex-center " style="margin-top: 10px;">
						<view
							class="comfir-btn flex flex-1 flex-center"
							type="default"
							style="max-width: 50%;"
							@click="
								$refs.popupPayToLaw.open();
							"
						>
							我要付款
						</view>
					</view>
				</view>

			</view> -->
		</view>

    <!-- 我要付款弹出层 -->

    <uni-popup ref="popupReceiveMoneydetail" type="dialog">
      <order-popup-common title="代付详情" morenWidth="660"  @closePop="closePop('popupReceiveMoneydetail')">
        <template slot="popup-con">
          <view style="padding:  0rpx 40rpx 20rpx">
            <view class="od-box" style="width: 100%; padding: 0;">
              <view class="od-item marginbottom10"  style="align-items:center;">
                <view class="item-tip">收款人</view>
                <view class="item-right"><view class="item-txt">律师</view></view>
              </view>
              <view class="od-item marginbottom10" style="margin-bottom: 24rpx;">
                <view class="item-tip require">付款金额</view>
                <view class="item-right">
                  <view class="item-txt red item-txts">{{'￥'+current_item.money||0.00}}</view>
                </view>
              </view>
              <view class="od-item marginbottom10">
                <view class="item-tip require">付款事由</view>
                <view class="item-right">
                  <view class="item-txt item-txts">
                    {{current_item.origin == '后期费用'?getContent():current_item.name}}
                  </view>
                </view>
              </view>
            </view>
            <view class="dialog-tip-line" style="padding-top: 25rpx; padding-bottom: 0;">我已与律师确认付款事宜</view>
            <view class="btn-footer">
              <view class="btn-footer-sure" @click="closePop('popupReceiveMoneydetail');">确认</view>
            </view>
          </view>
        </template>
      </order-popup-common>
    </uni-popup>
		<uni-popup ref="popupPayToLaw">
			<service-popup-pay title="我要付款" btnText="我要支付" @closePop="closePop('popupPayToLaw')" @confirmPay="confirmPayToLaw">
				<template slot="payOption">
					<view class="od-box" style="width: 100%; padding: 0;">
						<view class="od-item marginbottom20">
							<view class="item-tip require">付款金额</view>
							<view class="item-right">
                <view class="item-txt" v-if="(info.order.offer != '活马'&&info.order.offer != '还魂马')||((info.order.offer == '活马'||info.order.offer == '还魂马')&&current_item.is_shou != 1)">
								  <view class="item-txt"><input type="number" class="ipt-border" placeholder="请输入" placeholder-class="placeholder" v-model="payToPrice" /></view>
                </view>
                <view class="item-txt item-txts red" v-else>{{'￥'+payToPrice}}</view>
              </view>
						</view>
						<view class="od-item marginbottom20">
							<view class="item-tip require">付款事由</view>
							<view class="item-right">
                <view class="item-txt" v-if="info.order.offer != '活马'&&info.order.offer != '还魂马'">
                  <textarea auto-height="true" class="textarea-border" :placeholder="placeholderText" placeholder-class="placeholder" v-model="payToReason" />
                </view>
								<view class="item-txt item-txts" v-else>{{payToReason}}</view>
							</view>
						</view>
					</view>
				</template>
			</service-popup-pay>
		</uni-popup>
		<!-- 支付弹出层 -->
		<uni-popup ref="popupWantPay">
			<service-popup-pay title="我要付款" btnText="我要支付" @closePop="closePop('popupWantPay')" @confirmPay="confirmPay">
				<template slot="payOption">
					<view class="od-item marginbottom20 fukuan">
						<view class="item-tip"><text>付款金额</text> <text class="red" style="margin-top: 6rpx;">*</text></view>
						<view class="">
							<view class="item-txt red" v-if="current_item.final_money">￥{{ current_item.final_money>current_item.money?current_item.final_money:current_item.money }}</view>
							<view class="item-txt red" v-else>￥{{ current_item.money }}</view>
						</view>
					</view>
				</template>
			</service-popup-pay>
		</uni-popup>
		<!-- 退回申请弹出层 -->
		<uni-popup ref="popupReturnReason" type="dialog">
			<uni-popup-dialog-reason
				type="info"
				title=""
				okTxt="确认"
				cancleTxt="取消"
				:showClose="true"
				:before-close="true"
				@confirm="
					$refs.popupReturnReason.close();
					backApply(1);
				"
				@close="closePop('popupReturnReason')"
			>
				<view class="return-reason-box" v-if="zifei==''">
					<view class="return-tip">退回理由</view>

					<textarea class="textarea-border textarea-height" placeholder="请输入" placeholder-class="placeholder" v-model="applyReason" />
				</view>
        <view class="return-reason-box" v-else style="text-align: center;padding:40rpx 0;">确认退回申请</view>
			</uni-popup-dialog-reason>
		</uni-popup>
		<!-- 退回申请弹出层 -->
		<uni-popup ref="popupReturnReason2" type="dialog">
			<uni-popup-dialog-reason
				type="info"
				title=""
				okTxt="确认"
				cancleTxt="取消"
				:before-close="true"
				@confirm="
					backApply(2);
				"
        @close="$refs.popupReturnReason2.close();"
			>
				<view class="return-reason-box">
					<view class="return-tip" style="display: flex;align-items: center"><text>退回理由</text><text class="red"style="display: flex;height: 100%;align-items: center;padding-top: 10rpx;">*</text></view>
					<textarea class="textarea-border textarea-height" placeholder="请输入" placeholder-class="placeholder" v-model="applyReason" />
				</view>
			</uni-popup-dialog-reason>
		</uni-popup>
		<!-- 滞纳金详情弹出层 -->
		<uni-popup ref="popupFeeDetail" type="center">
			<order-popup-common morenWidth="660"  title="滞纳金明细" @closePop="closePop('popupFeeDetail')">
				<template slot="popup-con">
					<scroll-view class="popup-con" scroll-y="true">
						<view class="wait-box margin0">
							<view class="wait-item" v-for="(item, index) in latefeeInfo" style="border:none" :class="{ textOver: item.isreduction == 1 }">
								<view class="item-item">
									<view class="item-money">
										<view>￥{{ item.fee }}</view>
									</view>
									<view class="item-txt">
										<view class="txt-name">
											<view class="name-tip text-ellipsis">{{ item.feestr }}</view>
										</view>
									</view>
									<view class="item-btn">
										<view class="item-btn-txt">{{ item.steptime }}</view>
									</view>
								</view>
							</view>
						</view>
					</scroll-view>
					<view class="fee-tip">亲爱的, 尽快付款哦, 不要让律师躺赚滞纳金~</view>
					<view class="ok-box"><button type="default" class="ok-btn" @click="closePop('popupFeeDetail')">朕知道了</button></view>
				</template>
			</order-popup-common>
		</uni-popup>
		<!-- 减免滞纳金弹出层 -->
		<uni-popup ref="popupReduceFee" type="center">
			<order-popup-common  morenWidth="660" title="减免滞纳金" @closePop="closePop('popupReduceFee')">
				<template slot="popup-con">
					<scroll-view class="popup-con" scroll-y="true">
						<view class="od-box margin0 paddingbottom0">
							<view class="od-item marginbottom20">
								<view class="item-tip">已产生滞纳金时间段</view>
								<view class="item-right">
									<view class="item-txt">
										<view class="gray">{{ current_item.late_start_time }}至{{ current_item.late_time }}</view>
									</view>
								</view>
							</view>
							<view class="od-item marginbottom20" v-if="current_fee_list.length > 0">
								<view class="item-tip">已申请时间段</view>
								<view class="item-right">
									<view class="item-txt">
										<view class="gray" v-for="current_fee_item in current_fee_list">{{ current_fee_item.start_time }}至{{ current_fee_item.end_time }}</view>
									</view>
								</view>
							</view>
							<view class="od-item marginbottom20">
								<view class="item-tip require">减免时间段</view>
								<view class="item-right">
									<view class="item-jg-tip" @click="showFeeBeginTime = true">
										<view v-if="feeBeginTime">{{ feeBeginTime.year + '-' + feeBeginTime.month + '-' + feeBeginTime.day }}</view>
										<view v-else>开始时间</view>
										<view class="item-nav"><image src="@/static/img/right.png" mode="aspectFit"></image></view>
									</view>
									<view class="item-jg">--</view>
									<view class="item-jg-tip" @click="showFeeEndTime = true">
										<view v-if="feeEndTime">{{ feeEndTime.year + '-' + feeEndTime.month + '-' + feeEndTime.day }}</view>
										<view v-else>截止时间</view>
										<view class="item-nav"><image src="@/static/img/right.png" mode="aspectFit"></image></view>
									</view>
								</view>
							</view>
							<view class="od-item marginbottom20">
								<view class="item-tip">减免金额</view>
								<view class="item-right">
									<view class="item-txt">
										<text class="red">￥</text>
										<text class="red" v-if="feeMoney">{{ feeMoney }}</text>
										<text class="gray" v-else>请选择减免时间段</text>
									</view>
								</view>
							</view>
							<view class="od-item marginbottom20">
								<view class="item-tip require">申请理由</view>
								<view class="item-right">
									<view class="item-txt"><input type="text" class="ipt-border" placeholder="请输入" placeholder-class="placeholder" v-model="feeReason" /></view>
								</view>
							</view>
						</view>
						<view class="fee-middle-tip">我已与律师沟通好减免事宜</view>
					</scroll-view>
					<view class="ok-box"><button type="default" class="ok-btn" @click="confirmReduceFee">我要减免</button></view>
				</template>
			</order-popup-common>
		</uni-popup>

		<u-picker mode="time" v-model="showFeeBeginTime" confirm-color="#FFC801" @confirm="confirmFeeBeginTime"></u-picker>
		<u-picker mode="time" v-model="showFeeEndTime" confirm-color="#FFC801" @confirm="confirmFeeEndTime"></u-picker>
		<!-- 取消申请滞纳金弹出层 -->
		<uni-popup ref="popupCancelReduceFee" type="dialog">
			<uni-popup-dialog
				type="info"
				okTxt="是"
				cancleTxt="否"
				content="确认取消"
				:before-close="true"
				@confirm="
					closePop('popupCancelReduceFee');
					confirmCancelReduceFee();
				"
				@close="closePop('popupCancelReduceFee')"
			></uni-popup-dialog>
		</uni-popup>
		<!-- 取消付款弹出层 -->
		<uni-popup ref="popupCancelPay" type="dialog">
			<uni-popup-dialog
				type="info"
				okTxt="是"
				cancleTxt="否"
				content="取消付款"
				:before-close="true"
				@confirm="confirmServiceOk"
				@close="$refs.popupCancelPay.close();"
			></uni-popup-dialog>
		</uni-popup>
		<order-telephone name="律师" :phoneNumber="info.order.lawyer_mobile" ref="telephoneLawyer"
						 v-if="info.order.lawyer_mobile"></order-telephone>
	</view>
</template>

<script>
import {mapGetters} from 'vuex';
export default {
	props: ['info',"zifei"],
	data() {
		return {
			current_item: {},
			applyReason: '',
			latefeeInfo: [],
			showFeeBeginTime: false,
			showFeeEndTime: false,
			feeBeginTime: '',
			feeEndTime: '',
			feeReason: '',
			feeMoney: '',
			payToPrice: '', //付款给律师-金额
			payToReason: '', //付款给律师-原因
			current_fee_list: [],
			text:'',
			placeholderText:'请输入'
		};
	},
	computed: {
		...mapGetters(['userInfo'])
	},
	created() {

		// 安卓
		window.payOk = this.payOk;
	},
	methods: {
    timeup(e,index,item){
      item.isfinshed = false;
      console.log("==========index",index)
      this.$emit('clearTime',index)
    },
		itemClick(item) {
			this.$emit('popupShow',item)
		},
		async confirmPay(payMethod) {

			let pay_type;
			let order_id;
			if (this.current_item.fen == 6) {
				//fen == 6付款给律师
				pay_type = 2;
				order_id = this.current_item.id;
			} else {
				//fen == 2 二期；fen == 3 三期；fen == 4 先用后付；fen == 5 律师点我要收款；
				pay_type = 3;
				order_id = this.current_item.id;
			}
			let formDataPay = {
				order_id: order_id,
				payMethod: payMethod,
				fen: this.current_item.fen,
				pay_type: pay_type
			};

			var that=this;
			let resPay = await this.$pay(formDataPay);
			if (resPay == 1) {
				that.$refs.popupWantPay.close();
				that.$emit('init');
			}
		},
		// 付款给律师-支付
		async confirmPayToLaw(payMethod) {
			var that=this;
			if (this.payToPrice < 0.01) {
				uni.showToast({
					title: '请输入正确的金额',
					icon: 'none'
				});
				return;
			}
			if (!this.payToReason) {
				uni.showToast({
					title: '请输入付款事由',
					icon: 'none'
				});
				return;
			}
			this.$refs.popupPayToLaw.close();
			let formData = {
				id: this.current_item.id,
				token: uni.getStorageSync('token'),
				reason: this.payToReason,
				pay_type: payMethod,
				money: this.payToPrice
			};
			let res = await this.$api('index.updatePayMoneyLog', formData);
			/* 	console.log('SX');
			console.log( this.current_item);
			console.log(formData);
			console.log('SX');
			console.log(this.current_item.fen); */
			//return ;
			if (res.code == 1) {
				let formDataPay = {
					order_id: res.data.id,
					payMethod: payMethod,
					fen: this.current_item.fen,
					pay_type: 3
				};
				console.log(formDataPay);
				console.log('XX');
				let resPay = await this.$pay(formDataPay);
				if (resPay == 1) {
					uni.showToast({
						title: res.msg,
						icon: 'none'
					});
					that.$emit('init');
				}
			}
		},
		payOk(res) {
			var that=this;
			// 安卓0 支付成功，-1 支付失败， -2取消支付
			if (res == '0') {
				that.$refs.popupWantPay.close();
				that.$emit('init');
			}
		},
		async backApply(type) {
			if(type == 2 && this.applyReason == ''){
				uni.showToast({
					title: '请输入退回原因',
					icon: 'none'
				});
				return false;
			}
			this.$refs.popupReturnReason2.close();
			let formData = {
				id: this.current_item.id,
				token: uni.getStorageSync('token'),
				origin: this.applyReason
			};
			let res = await this.$api('index.user_back', formData);
			if (res.code == 1) {
				uni.showToast({
					title: res.msg,
					icon: 'none'
				});
				this.$emit('init');
			}
		},
		// 滞纳金详情
		async lateFeeDetail(item) {
			let formData = {
				id: this.info.order.id,
				step: item.fen,
				token: uni.getStorageSync('token')
			};
			let res = await this.$api('latefee.detail', formData);
			this.latefeeInfo = res.data;
			this.$refs.popupFeeDetail.open();
		},
		// 开始时间确认
		confirmFeeBeginTime(e) {
			let time1 = Date.parse(new Date(this.current_item.late_start_time.replace(/-/g, '/')));
			let time2 = Date.parse(new Date(this.current_item.late_time.replace(/-/g, '/')));

			let t = `${e.year}-${e.month}-${e.day}`;
			let time = Date.parse(new Date(t.replace(/-/g, '/')));

			if (time <= time2 && time >= time1) {
				this.feeBeginTime = e;
				this.calcFee();
			} else {
				uni.showToast({
					title: `请选择减免滞纳金内的日期：${this.current_item.late_start_time}至${this.current_item.late_time}`,
					icon: 'none'
				});
			}
		},
		// 结束时间确认
		confirmFeeEndTime(e) {
			let time1 = Date.parse(new Date(this.current_item.late_start_time.replace(/-/g, '/')));
			let time2 = Date.parse(new Date(this.current_item.late_time.replace(/-/g, '/')));

			let t = `${e.year}-${e.month}-${e.day}`;
			let time = Date.parse(new Date(t.replace(/-/g, '/')));

			if (time <= time2 && time >= time1) {
				this.feeEndTime = e;
				this.calcFee();
			} else {
				uni.showToast({
					title: `请选择减免滞纳金内的日期： ${this.current_item.late_start_time}至${this.current_item.late_time}`,
					icon: 'none'
				});
			}
		},
		// 减免金额计算
		async calcFee() {
			if (!this.feeBeginTime) {
				uni.showToast({
					title: '请选择开始时间',
					icon: 'none'
				});
				return;
			}
			if (!this.feeEndTime) {
				uni.showToast({
					title: '请选择截止时间',
					icon: 'none'
				});
				return;
			}
			let formData = {
				start_time: this.feeBeginTime.timestamp,
				end_time: this.feeEndTime.timestamp,
				money: this.current_item.money,
				reason: this.feeReason,
				token: uni.getStorageSync('token'),
				id: this.info.order.id,
				step: this.current_item.fen
			};
			let res = await this.$api('latefee.calculation', formData);
			if (res.code == 1) {
				this.feeMoney = res.data.fee;
			}
		},

		// 我要减免
		async confirmReduceFee() {
			if (!this.feeReason) {
				uni.showToast({
					title: '请输入申请理由',
					icon: 'none'
				});
				return;
			}
			if (!this.feeBeginTime) {
				uni.showToast({
					title: '请选择开始时间',
					icon: 'none'
				});
				return;
			}
			if (!this.feeEndTime) {
				uni.showToast({
					title: '请选择截止时间',
					icon: 'none'
				});
				return;
			}

			this.closePop('popupReduceFee');

			let formData = {
				id: this.info.order.id,
				step: this.current_item.fen,
				fee: this.feeMoney,
				start_time: this.feeBeginTime.timestamp,
				end_time: this.feeEndTime.timestamp,
				reason: this.feeReason,
				token: uni.getStorageSync('token'),
				type: 1,
				user_id: this.info.order.user_id
			};
			let res = await this.$api('latefee.applay_reduction', formData);
			if (res.code == 1) {
				this.$emit('init');
				uni.showToast({
					title: res.msg,
					icon: 'none'
				});
			}
		},
		// 取消申请滞纳金
		async confirmCancelReduceFee() {
			let formData = {
				id: this.current_item.isapplay,
				token: uni.getStorageSync('token'),
				isreduction: 0
			};
			let res = await this.$api('latefee.setreply', formData);
			if (res.code == 1) {
				this.$emit('init');
				uni.showToast({
					title: res.msg,
					icon: 'none'
				});
			}
		},
		async getCurrentFeeList() {
			let formData = {
				id: this.info.order.id,
				token: uni.getStorageSync('token'),
				step: this.current_item.fen
			};
			let res = await this.$api('latefee.applay_list', formData);
			if (res.code == 1) {
				this.current_fee_list = res.data;
			}
		},
		// 0401文档新增接口
		async confirmServiceOk(){
			let formData = {
			    id: this.current_item.id,
			    token: uni.getStorageSync('token')
			   };
			   let res = await this.$api('index.cancel_money2', formData);
			   if (res.code == 1) {
			    uni.showToast({
			     title: res.msg,
			     icon: 'none'
			    });
				this.$refs.popupCancelPay.close()
			    this.$emit('init');
			   }

		},
		popupPayToLawClick(item){
			this.current_item = item;
			this.$refs.popupPayToLaw.open();
			console.log(this.info.order.offer,'-----')
			console.log(this.info.order.self_ident,'-----12')
			this.placeholderText = '请输入'
			if(this.info.order.offer == '活马'){
			  this.payToPrice = this.current_item.money=='0.00'?'':this.current_item.money
        if(this.info.order.self_ident == '收款方'){
			    this.placeholderText = '按律师帮您回收款物金额的8%算'
          this.payToReason = this.placeholderText

				}else if(this.info.order.self_ident == '应诉方'){
			this.placeholderText = '按律师帮您减少支出金额的8%算'
          this.payToReason = this.placeholderText

				}
			}else if(this.info.order.offer == '还魂马'){
        this.payToPrice = this.current_item.money=='0.00'?'':this.current_item.money
				if(this.info.order.self_ident == '收款方'){
			    this.placeholderText = '按律师帮您回收款物金额的30%算'
          this.payToReason = this.placeholderText

				}else if(this.info.order.self_ident == '应诉方'){
				  this.placeholderText = '按律师帮您减少支出金额的30%算'
          this.payToReason = this.placeholderText
				}
			}

		},
    getContent(){
      let content = ''
      let offer = this.info.order.offer
      if(offer == '活马'){
        if(this.info.order.self_ident == '应诉方'){
          content = '按律师帮您减少支出'
        }else{
          content = '按律师帮您回收款物'
        }
        return content + '金额的8%算'
      }else if(offer == '还魂马'){
        if(this.info.order.self_ident == '应诉方'){
          content = '按律师帮您减少支出'
        }else{
          content = '按律师帮您回收款物'
        }
        return content + '金额的30%算'
      }else{
        return '我已与委托人确定付款事宜'
      }
    }
	}
};
</script>

<style lang="scss">
	.od-box .od-item .item-right .item-txt{
		flex-wrap: wrap;
	}
  .od-box .od-item .item-right .item-txts{
    line-height: inherit;
  }
	.image-r {
		width: 8px;
		height: 12px;
		margin-left: 35px;
	}
  .fukuan{
    display: flex;
    align-items: center;
  }
  .btn-footer{
    width: 100%;
    height: 40px;
    margin: 10px;
    .btn-footer-sure{
      width: 50%;
      margin: 10px auto;
      background: #FFC801;
      border-radius: 52rpx;
      color: #ffffff;
      display: flex;
      align-items: center;
      justify-content: center;
      height: 100%;
    }
  }
  .ok-btn{
    max-width: 50%;
    height: 30px!important;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 15px;
    flex: 1;
  }
</style>
